<?php


/**
* Puree CMS
* http://www.molotsoft.ru
*
* @package Puree_CMS
* @subpackage Controllers
* @author Ivan Chistyakov <ivan@molotsoft.ru>
* @version $Id: users_controller.php 1283 2010-04-06 06:27:17Z molotsoft@gmail.com $
* @link $HeadURL: http://puree-cms.googlecode.com/svn/trunk/controllers/users_controller.php $
*/


class UsersController extends GeneralController {

/******************************************************************************/

var $name = 'Users';

/******************************************************************************/

function admin_login() {
	if ($this->Auth->isAuthorized()) {
		$this->redirect($this->Auth->loginRedirect);
	}
	// nothing to do
}

function admin_welcome() {
	// nothing to do
}

function admin_profile() {
	$this->redirect(array('action' => 'edit', 'id' => $this->Auth->user('id')));
}

function admin_logout() {
	$this->redirect($this->Auth->logout());
}

/****************************************************************************/

function admin_edit($id = NULL) {
	// unset password which empty
	if (isset($this->data['User']['password']) && ($this->data['User']['password'] === $this->Auth->password(''))) {
		unset($this->data['User']['password']);
	}
	$this->automateRender = FALSE;
	parent::admin_edit($id);
	// hide password
	if (isset($this->data['User']['password'])) {
		$this->data['User']['password'] = '';
	}
}

/******************************************************************************/

}


?>